import BaseModel from "../../cfw/mvc/BaseModel";
import DecorationMgrInterface from "../../public/interface/DecorationMgrInterface";
import ModelManager from "../../cfw/mvc/ModelManager";
import DecorationColumnModel from "./model/DecorationColumnModel";
import ModuleManager from "../../cfw/module/ModuleManager";
import XlsxData from "../../cfw/xlsx/XlsxData";
import { DecorationColumnModelEnum, DecorationItemModelEnum } from "../../public/GameEnumConfig";
import DecorationManager from "./DecorationManager";
import DecorationItemModel from "./model/DecorationItemModel";
import TextureInfo from "../../engine/comps/TextureInfo";

export default class LivingRoomManager extends BaseModel implements DecorationMgrInterface {



    protected suitcaseID: number = 1;
    protected columnMgr: ModelManager<DecorationColumnModel> = new ModelManager();
    protected columnList: DecorationColumnModel[] = []

    constructor(suitID: number) {
        super();
        this.suitcaseID = suitID;
        this.columnMgr.initWithData(ModuleManager.dataManager.get(DecorationColumnModel.CLASS_NAME), DecorationColumnModel)
        let columnData: XlsxData = this.columnMgr.getData()

        if (columnData) {
            let columList = columnData.getIndexByID(DecorationColumnModelEnum.house, this.suitcaseID)
            // cc.log('columList ', columList)
            for (let index = 0; index < columList.length; index++) {
                const element = columList[index];
                let columnItem: DecorationColumnModel = this.columnMgr.getByID(element)
                this.columnList.push(columnItem)

            }
        }
    }

    getColumnList() {
        return this.columnList;
    }

    getContentList(columnID) {
        let list = []
        let clothData: XlsxData = DecorationManager.instance().getDecorationData();
        let clotheIDLsit = clothData.getIndexByID(DecorationItemModelEnum.columnID, columnID)
        // cc.log('clotheIDLsit ', clotheIDLsit)
        for (let index = 0; index < clotheIDLsit.length; index++) {
            const element = clotheIDLsit[index];
            let clotheItem: DecorationItemModel = DecorationManager.instance().getDecoration(element)
            list.push(clotheItem)
        }
        return list;
    }



}
